clear
set more off

* use data entitled CCES 2014 Colorado.dta (ignore my filepath in the next line)
use "c:/bnewman transferred files/research/representation/income and dr/experiment 1 CCES for replication.dta"

*renaming variables*
rename CUB3JG1_treat treatment
rename CUB3JG1 vote_jones
rename CUB3JG2 represent
rename CUB3JG3 leadership
rename CUB3JG4 cares
rename CUB3JG5 honest
rename CUB3JG6 intelligent
rename CUB3JG7 party_jones

* code all so positive is higher
replace represent=(represent*-1)+5
replace leadership=(leadership*-1)+6
replace cares=(cares*-1)+6
replace honest=(honest*-1)+6
replace intelligent=(intelligent*-1)+6


svyset [pw=weight]

*combining treatments into $3 million(1), $75,000(2), No income stated(3)*
generate treatment_jones=.
replace treatment_jones=1 if (treatment==1)
replace treatment_jones=1 if (treatment==2)
replace treatment_jones=2 if (treatment==3)
replace treatment_jones=2 if (treatment==4)
replace treatment_jones=3 if (treatment==5)
replace treatment_jones=3 if (treatment==6)

* recode all to 0-1 scale
gen leadership01=.
replace leadership01=0 if leadership==1
replace leadership01=.25 if leadership==2
replace leadership01=.5 if leadership==3
replace leadership01=.75 if leadership==4
replace leadership01=1 if leadership==5
tab leadership leadership01

gen intelligent01=.
replace intelligent01=0 if intelligent==1
replace intelligent01=.25 if intelligent==2
replace intelligent01=.5 if intelligent==3
replace intelligent01=.75 if intelligent==4
replace intelligent01=1 if intelligent==5
tab intelligent intelligent01

gen cares01=.
replace cares01=0 if cares==1
replace cares01=.25 if cares==2
replace cares01=.5 if cares==3
replace cares01=.75 if cares==4
replace cares01=1 if cares==5
tab cares cares01

gen honest01=.
replace honest01=0 if honest==1
replace honest01=.25 if honest==2
replace honest01=.5 if honest==3
replace honest01=.75 if honest==4
replace honest01=1 if honest==5
tab honest honest01

gen represent01=.
replace represent01=0 if represent==1
replace represent01=.33 if represent==2
replace represent01=.66 if represent==3
replace represent01=1 if represent==4
tab represent represent01

gen vote_jones01=.
replace vote_jones01=0 if vote_jones==1
replace vote_jones01=.33 if vote_jones==2
replace vote_jones01=.66 if vote_jones==3
replace vote_jones01=1 if vote_jones==4
tab vote_jones vote_jones01

* Figure 1
mean leadership01 [pw=weight], over (treatment_jones)
mean intelligent01 [pw=weight], over (treatment_jones)
mean cares01 [pw=weight], over (treatment_jones)
mean honest01 [pw=weight], over (treatment_jones)
mean represent01 [pw=weight], over (treatment_jones)
mean vote_jones01 [pw=weight], over (treatment_jones)

* set up treatment so that 0 = no income stated, 1 = 75k, 2 = 3 million
* regression setup for hypothesis tests, comparison group is 0, no income stated
gen treatment_recode=(treatment_jones*-1)+3

svy: reg leadership01 i.treatment_recode
svy: reg intelligent01 i.treatment_recode
svy: reg cares01 i.treatment_recode
svy: reg honest01 i.treatment_recode
svy: reg represent01 i.treatment_recode
svy: reg vote_jones01 i.treatment_recode

* Figure 2 bars are comparison of $3 million (category 2) - no income stated (0 or "base")
svy: reg leadership01 i.treatment_recode
contrast treatment_recode, effects

svy: reg intelligent01 i.treatment_recode
contrast treatment_recode, effects

svy: reg cares01 i.treatment_recode
contrast treatment_recode, effects

svy: reg honest01 i.treatment_recode
contrast treatment_recode, effects

svy: reg represent01 i.treatment_recode
contrast treatment_recode, effects

svy: reg vote_jones01 i.treatment_recode
contrast treatment_recode, effects

* oprobits for appendix
oprobit leadership i.treatment_recode
oprobit intelligent i.treatment_recode
oprobit honest i.treatment_recode
oprobit cares i.treatment_recode
oprobit represent i.treatment_recode
oprobit vote_jones i.treatment_recode


